#ifndef CORE_CRITICALSECTION_H
#define CORE_CRITICALSECTION_H

class CCriticalSection
{
public:

	CCriticalSection();

	~CCriticalSection();

	void enter();

	void leave();

private:

#ifdef WIN32

	CRITICAL_SECTION m_cs;

#endif

};


class CTempLock
{
public:

	CTempLock(CCriticalSection &_cs)
		: m_cs(_cs)
	{
		m_cs.enter();
	}

	~CTempLock()
	{
		m_cs.leave();
	}

private:

	CCriticalSection &m_cs;

};

#endif //CORE_CRITICALSECTION_H
